var getIntelligentScoreDetailsTable = {
    id: "getIntelligentScoreDetailsTable",
    seItem: null,
    table: null,
    layerIndex: -1
};

getIntelligentScoreDetailsTable.initColumn = function () {
    var columns = [
        {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
        {
            title: '图片类型', field: 'photoType', align: 'center', valign: 'middle', width: 50,
            formatter: function (value, row, index) {
                if (value == "1") {
                    return "术前"
                } else if (value == "2") {
                    return "术中";
                } else {
                    return "术后";
                }
            }
        },
        {title: 'A1', field: 'a', align: 'center', valign: 'middle', width: 30},
        {title: 'A2', field: 'b', align: 'center', valign: 'middle', width: 30},
        {title: 'A3', field: 'c', align: 'center', valign: 'middle', width: 30},
        {title: 'A4', field: 'd', align: 'center', valign: 'middle', width: 30},
        {title: 'A5', field: 'e', align: 'center', valign: 'middle', width: 30},
        {title: 'A6', field: 'f', align: 'center', valign: 'middle', width: 30},
        {title: 'A7', field: 'g', align: 'center', valign: 'middle', width: 30},
        {title: '得分', field: 'score', align: 'center', valign: 'middle', width: 30},
        {title: '时间', field: 'createTime', align: 'center', valign: 'middle', width: 50,
            formatter: function (value, row, index) {
                return value.substring(0, 19);
            }
        },
    ];
    return columns;
};

/**
 * 查询预约客户列表
 */
getIntelligentScoreDetailsTable.search = function () {
    getIntelligentScoreDetailsTable.table.refresh();
};

$(function () {
    var id2 = $("#id").val();
    var defaultColunms = getIntelligentScoreDetailsTable.initColumn();
    var table = new BSTable(getIntelligentScoreDetailsTable.id, "/caseSelection/getIntelligentScoreDetailsList/" + id2, defaultColunms);
    getIntelligentScoreDetailsTable.table = table.init();
    getIntelligentScoreDetailsTable.search();
    $('#getIntelligentScoreDetailsTable').bootstrapTable('resetView', {height: $(window).height() - 450});
});

function intelligenceSubmission() {
    var id2 = $("#id").val();
    var imagePathPreoperative = $("#imagePathPreoperative").val();
    var imagePathIntraoperative = $("#imagePathIntraoperative").val();
    var imagePathPostoperative = $("#imagePathPostoperative").val();
    var leftUp = $("#leftUp").html();
    var rightUp = $("#rightUp").html();
    var leftDown = $("#leftDown").html();
    var rightDown = $("#rightDown").html();
    if(imagePathPreoperative === "" || imagePathPreoperative === undefined){
        alert("术前未操作！");
        return false;
    }
    if(imagePathIntraoperative === "" || imagePathIntraoperative === undefined){
        alert("术中未操作！");
        return false;
    }
    if(imagePathPostoperative === "" || imagePathPostoperative === undefined){
        alert("术后未操作！");
        return false;
    }
    $.ajax({
        url: Feng.ctxPath + "/intelligent/evaluation",
        type: "post",
        data: {
            "imagePathPreoperative": imagePathPreoperative,
            "imagePathIntraoperative": imagePathIntraoperative,
            "imagePathPostoperative": imagePathPostoperative,
            "id2": id2
        },
        success: function (data) {
            Feng.success("评选成功");
        }
    });
}

function intellSave() {
    var id2 = $("#id").val();
    var imagePathPreoperative = $("#imagePathPreoperative").val();
    var imagePathIntraoperative = $("#imagePathIntraoperative").val();
    var imagePathPostoperative = $("#imagePathPostoperative").val();
    if(imagePathPreoperative === "" || imagePathPreoperative === undefined){
        alert("术前未操作！");
        return false;
    }
    if(imagePathIntraoperative === "" || imagePathIntraoperative === undefined){
        alert("术中未操作！");
        return false;
    }
    if(imagePathPostoperative === "" || imagePathPostoperative === undefined){
        alert("术后未操作！");
        return false;
    }
    $.ajax({
        url: Feng.ctxPath + "/intelligent/evaluations",
        type: "post",
        data: {
            "imagePathPreoperative": imagePathPreoperative,
            "imagePathIntraoperative": imagePathIntraoperative,
            "imagePathPostoperative": imagePathPostoperative,
            "id2": id2
        },
        success: function (data) {
            Feng.success("保存成功");
        }
    });
}